package com.xinhe.web.controller;

import com.xinhe.web.annotation.WebUsed;
import com.xinhe.web.common.Result;
import com.xinhe.web.entity.GoodsZoneType;
import com.xinhe.web.response.GoodsZoneTypeView;
import com.xinhe.web.service.GoodsZoneTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "商品专区分类列表", tags = {"商品专区分类列表"})
@RestController
@RequestMapping(value = {"/goodsZoneType"}, produces = {"application/json;charset=UTF-8"})

public class GoodsZoneTypeController {
    @Autowired
    private GoodsZoneTypeService goodsZoneTypeService;

    @WebUsed
    @ApiOperation(httpMethod = "GET", value = "分页查询商品专区分类")
    @RequestMapping({"/pageGoodsZoneType"})
    public Result<List<GoodsZoneTypeView>> pageGoodsZoneType() {
        return this.goodsZoneTypeService.pageGoodsZoneType();
    }

    @WebUsed
    @ApiOperation(httpMethod = "POST", value = "保存商品专区分类")
    @RequestMapping({"/saveGoodsZoneType"})
    public Result saveGoodsZoneType(Long id,String name,String iconPath,Integer seq,String remark) {
        return this.goodsZoneTypeService.saveModel(id,name,iconPath,seq,remark);
    }

    @WebUsed
    @ApiOperation(httpMethod = "GET", value = "删除商品专区分类")
    @ApiImplicitParam(name = "goodsZoneTypeId", value = "标识", dataTypeClass = Long.class, required = true)
    @RequestMapping({"/deleteGoodsZoneType"})
    public Result deleteGoodsZoneType(Long goodsZoneTypeId) {
        return this.goodsZoneTypeService.delete(goodsZoneTypeId);
    }

    @WebUsed
    @ApiOperation(httpMethod = "GET", value = "商品专区分类详情")
    @ApiImplicitParam(name = "goodsZoneTypeId", value = "标识", dataTypeClass = Long.class, required = true)
    @RequestMapping({"/detailGoodsZoneType"})
    public Result<GoodsZoneType> detailGoodsZoneType(Long goodsZoneTypeId) {
        return this.goodsZoneTypeService.findById(goodsZoneTypeId);
    }
}
